<template>
	<view style="padding: 30rpx;">
		<button @click="callSetStorage()">setStorage</button>
		<button @click="callgetStorage()">getStorage</button>
		<button @click="callStoInfo()" type="primary">getStoInfo</button>
		<button @click="callRemove()" type="warn" plain="true">remove</button>
		<button @click="callClear()" type="warn">clear</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {

			}
		},
		methods: {
			callSetStorage() {
				console.log("callSetStorage-->userName chenyuanzhu");
				uni.setStorage({
					key: "className",
					data: "23computer",
					success() {
						console.log("storage userName success");
					},
					fail() {
						console.log("storage userName fail");
					}
				})
			},
			callgetStorage() {
				uni.getStorage({
					key: "className",
					success: function(result) {
						console.log("get local catches success result.data:" + result.data);

					},
					fail: function(result) {
						console.error("get local catches fail : " + JSON.stringify(result));
						console.error("get local catches fail : " + result.errMsg);
					}
				})
			},
			callStoInfo() {
				console.log("callStoInfo-->");
				uni.getStorageInfo({
					success: function(result) {
						console.log("callStoInfo-->" + JSON.stringify(result));
						console.log("callStoInfo-->" + result.keys);

					}
				})
			},
			callRemove(){
				uni.removeStorage({
					key:"className",
					success: () => {
						console.log("remove success");
					},fail: () => {
						console.log("remove fail");
					}
				})
			},
			callClear(){
				uni.clearStorage();
				console.log("clear finish");
			}
		}
	}
</script>

<style>
	button {
		margin: 30rpx;
	}
</style>